#include <iostream>

// 饿汉模式
class ehan
{

public:
    ehan()
    {
        std::cout << "i am an ehan" << std::endl;
    }

    static ehan& getinstance()
    {
        return _e;
    }
    ~ehan() {}

private:
  //禁用拷贝构造与赋值重载：
   ehan(const ehan &)=delete;
   ehan operator =(const ehan &)=delete;
    static ehan _e; // 这里只是声明没有定义
};

ehan ehan:: _e;

class lanhan
{
public:
    lanhan()
    {
        std::cout << "i am an lanhan" << std::endl;
    }

    static lanhan &getinstance()
    {
       static lanhan l;
       return l;
    }
    ~lanhan() {}

private:
//禁用拷贝构造与赋值重载：
   lanhan(const lanhan &)=delete;
   lanhan operator =(const lanhan &)=delete;
    
};

int main()
{
    ehan::getinstance();
    lanhan::getinstance();

    return 0;
}